//
//  WQ_NetWorkingResult.swift
//  xinlang
//
//  Created by 联创—王增辉 on 2019/3/25.
//  Copyright © 2019年 lcWorld. All rights reserved.
//

import Moya



class WQ_NetWorkingResult<Model: Codable> {

    var data: Model?
    var success: Bool
    var message: String?
    
    init(data: Any) {
        guard let jsonData = try? JSONSerialization.data(withJSONObject: data, options: .prettyPrinted),let objc = try? JSONDecoder().decode(Model.self, from: jsonData) else {
            success = false
            message = "解析失败"
            return
        }
        success = true
        self.data = objc
    }
    
    init(errorMsg: String?) {
        success = false
        message = errorMsg
    }
}
